//
//  YLAPriceView.swift
//  Your Lover AI
//
//  Created by 阿忠 on 2024/6/26.
//

import Foundation
import UIKit

/**
 会员选择的按钮
 */
class YLAPriceView: UIView , UITextFieldDelegate {
    //背景
    lazy var backVc: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hex: "6043FA")
        view.layer.cornerRadius = 15.0 // 设置圆角半径为10.0
        view.layer.masksToBounds = true
        return view
    }()
    let timeLabel = UILabel()
    let contentLabel = UILabel()
    let priceLabel = UILabel()

 
    
    init(frame: CGRect, time: String, content: String, price: String) {
        super.init(frame: frame)
        
        setupUI(time: time, content: content, price: price)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    private func setupUI(time: String, content: String, price: String) {
        // 设置自定义弹窗的样式和布局
        
        self.addSubview(backVc)
        backVc.snp.makeConstraints { make in
            make.left.top.right.bottom.equalToSuperview()
        }
        
        // 时间
        timeLabel.text = time
        timeLabel.textColor = UIColor(hex: "FFE295")
        timeLabel.font = UIFont.systemFont(ofSize: 17)
        timeLabel.textAlignment = .left
        self.addSubview(timeLabel)
        timeLabel.snp.makeConstraints { make in
            make.left.equalTo(18)
            make.top.equalTo(17.5)
        }
        
        // 内容
        contentLabel.text = content
        contentLabel.textColor = UIColor(hex: "FFE295")
        contentLabel.font = UIFont.systemFont(ofSize: 12)
        contentLabel.textAlignment = .left
        self.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { make in
            make.left.equalTo(18)
            make.top.equalTo(timeLabel.snp.bottom).offset(9)
        }
        
        // 价格
        priceLabel.text = price
        priceLabel.textColor = UIColor(hex: "FFE295")
        priceLabel.font = UIFont.systemFont(ofSize: 26)
        priceLabel.textAlignment = .left
        self.addSubview(priceLabel)
        priceLabel.snp.makeConstraints { make in
            make.right.equalTo(-18)
            make.centerY.equalToSuperview()
        }
        
    }
    

}
